#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<typeinfo>
#include<iostream>
using namespace std;


struct A
{
	int a;
	char b;
	double c;
	char d;
};

int main()
{
	struct A a;
	//a.a = 1;
	//a.b = 'Y';
	//a.c = 1.2f;
	//a.d = 'a';
	printf("%p\n", &a);
	//printf("%p\n", &(a.a));

	////cout << &a << endl;
	////cout << &(a.a) << endl;
	////cout << &(a.b) << endl;
	//printf("%p\n", &(a.b));
	//printf("%p\n", &(a.c));
	//printf("%p\n", &(a.d));
	////cout << &(a.c) << endl;
	////cout << &(a.d) << endl;

	////cout << 1111 << endl;
	////cout << (&(a.c)) -  & (((A*)0)->c) << endl;

	printf("%p\n", ((struct A*)(((&(a.d)-&(((struct A*)0)->d)))*sizeof(a.d))));
	printf("%p\n", ((struct A*)(((&(a.c)-&(((struct A*)0)->c)))*sizeof(a.c))));
	//printf("%p\n", ((struct A*)((&(a.c)-&(((struct A*)0)->c)))));
	////printf("%s", typeid(&(((struct A*)0)->c)).name());

	//double arr[3] = { 1.2,1.3,1.4 };
	//for (auto& e : arr)
	//{
	//	/*cout << &e << endl;*/
	//	printf("%d\n", &e);
	//}
	//cout << (&arr[2] - &arr[1]) << endl;
	//cout << (&arr[2] - &arr[0]) << endl;
}
